package c2.cross.business.ladder.rank;

import c2.cross.business.ladder.common.LadderOppoDetail;
import cate.game.play.part.PlaySide;
import cate.game.pvp.ladder.common.LadderLoadOppoPsQuery;
import cate.game.pvp.ladder.common.LadderLoadOppoPsResult;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class LadderLoadPsDo {

    public LadderLoadOppoPsResult exe(LadderRankModule rankMod, LadderLoadOppoPsQuery query) {
        LadderLoadOppoPsResult result = new LadderLoadOppoPsResult();
        LadderOppoDetail detail = rankMod.getOppoDetail(query.opponentId);
        if(detail == null) {
            log.warn("天梯赛：你要打的这个对手已经不在榜上了");
            return null;
        }
        /*if(detail.robot) {
            PlaySide ps = LadderRobotPlaySidePool.getRobotPs(detail.robotPsId).copy();
            ps.snapshot = detail.toRoleSnapshot();
            result.data = ps;
        } else {
            result.data = detail.rolePs;
        }*/
        if(detail.robot) {
            detail.rolePs.snapshot.uid = query.opponentId;
            detail.rolePs.snapshot.base.uid = query.opponentId;
        }
        result.data = detail.rolePs;
        result.rank = detail.rank;
        result.success();
        return result;
    }
}
